package com.wen.service.impl;

import com.github.pagehelper.PageHelper;
import com.wen.dao.PermissionMapper;
import com.wen.pojo.Permission;
import com.wen.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class PermissionServiceImpl implements PermissionService {
    @Autowired
    private PermissionMapper permissionMapper;

    @Override
    public List<Permission> findAll(int page, int size) throws Exception {
        PageHelper.startPage(page, size);
        return permissionMapper.findAll();
    }

    @Override
    public Permission findById(int id) throws Exception {

        return permissionMapper.findById(id);
    }

    @Override
    public int deleteById(int id) throws Exception {
        return permissionMapper.deleteById(id);
    }

    @Override
    public int updateById(Permission permission) throws Exception {
        return permissionMapper.updateById(permission);
    }

    @Override
    public int add(Permission permission) throws Exception {
        return permissionMapper.add(permission);
    }
}
